﻿using System.Data.Entity;

namespace Domain.RealiZation.B
{
    /// <summary>
    /// 1.基础 接口 基础访问接口，使用泛型
    /// </summary>
    public interface IBaseAbstract<T> where T : class
    {
        #region 基础访问
        /// <summary>
        /// 获取表达树
        /// </summary>
        /// <returns></returns>
        DbSet<T> GetDbSet();
        /// <summary>
        /// 根据主键 获取对象
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        T GetModel(object id);
        /// <summary>
        /// 添加对象
        /// </summary>
        /// <param name="model">实例对象</param>
        /// <returns></returns>
        bool Add(T model);
        /// <summary>
        /// 修改对象
        /// </summary>
        /// <param name="model">实例对象</param>
        /// <returns></returns>
        bool Modify(T model);
        /// <summary>
        /// 删除对象
        /// </summary>
        /// <param name="model">实例对象</param>
        /// <returns></returns>
        bool Delete(T model);
        /// <summary>
        /// 删除 对象
        /// </summary>
        /// <param name="id">主键ID</param>
        /// <returns></returns>
        bool Delete(object id);
        #endregion
    }
}
